package 线程;

import BIO.INetAddress_test;
import org.junit.Test;

import java.util.Scanner;

/**
 * @author:谢君臣
 * @Date:2021/8/27-16:53
 * @version:1.0
 * @function:
 */
public class TestStackOverFlow {
    boolean isRunNian(int year) {
        if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) return true;
        else return false;
    }
    int calcDayOfMonth(int year, int month) {
        int days = 0;
        int sum = 0;
        for (int i = 1; i <= month; i++) {
            switch (i) {            //这里应该用i做参数
                case 1: case 3: case 5: case 7: case 8: case 10: case 12:
                    days = 31;
                    break;
                case 4: case 6: case 9: case 11:
                    days = 30;
                    break;
                case 2:
                    if (isRunNian(year)) days = 29;
                    else days = 28;
            }
            sum += days;
        }
        return sum;
    }
    int calcDays(int year, int month) {
        int sum = 0;
        int days;
        for (int i = 1900; i < year; i++) {
            if (isRunNian(i)) {
                sum += 366;
            } else {
                sum += 365;
            }
        }
// 对月份中的天数进行处理
        days = calcDayOfMonth(year, month);
        sum += days;
        return sum;
    }
    public static void main(String[] args) {
// TODO 自动生成的方法存根
        TestStackOverFlow r = new TestStackOverFlow();
        Scanner s = new Scanner(System.in);
        int year = s.nextInt();;
        int month =s.nextInt();
        int sum = r.calcDays(year, month - 1);
        System.out.println((sum) % 7 + 1);
    }
}
